﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;

namespace QaaSimulation.QSim
{
    public class QOrientation
    {
        protected PointF m_Position;
        public PointF Position
        {
            get
            {
                return m_Position;
            }
            set
            {
                m_Position = value;
            }
        }

        protected PointF m_Direction = new PointF(1,0);
        public PointF Direction
        {
            get
            {
                return m_Direction;
            }
            set
            {
                PointF tmp = value;
                float length = QFunctions.Length(tmp);
                if (length != 1)
                {
                    tmp.X /= length;
                    tmp.Y /= length;
                }
                m_Direction = tmp;
            }
        }

        protected PointF m_MovementDirection;
        public PointF MovementDirection
        {
            get
            {
                return m_MovementDirection;
            }
            set
            {
                m_MovementDirection = value;
            }
        }

        public float MovementSpeed
        {
            get
            {
                return QFunctions.Length(m_MovementDirection);
            }
        }

        protected float m_RotationAngle;
        public float RotationAngle
        {
            get
            {
                return m_RotationAngle;
            }
            set
            {
                m_RotationAngle = value;
                m_Direction.X = (float)Math.Cos(m_RotationAngle / 180f * Math.PI);
                m_Direction.Y = (float)Math.Sin(m_RotationAngle / 180f * Math.PI);
            }
        }

    }
}
